package 面试;

import 多线程.S;

import java.util.Scanner;

/**
 * @author : K k
 * @date : 19:49 2020/9/22
 */
public class 字典序复制字符串 {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        String s = in.nextLine();
        if (s.length()==0){
            System.out.println("");
            return;
        }
        StringBuilder sb=new StringBuilder();

        int i=0;
        int j= s.length()-1;
        while(i<=j){
            if(s.charAt(i)<s.charAt(j)){
                sb.append(s.charAt(i));
                i++;
            }else {
                sb.append(s.charAt(j));
                j--;
            }
        }
        System.out.println(sb.toString());
    }
}
